package cn.edu.scau.cmi.liuan.singleton;

import java.util.ArrayList;
import javafx.application.*;
import javafx.scene.*;
import javafx.scene.control.Button;
import javafx.scene.layout.Pane;
import javafx.scene.text.Text;
import javafx.stage.*;
import cn.edu.scau.cmi.liuan.singleton.*;

public class test extends Application{
	Chairman cm = null;
	
	Button create = new Button();
	Text name = new Text();
	Pane p = new Pane();
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//实验二测试
		launch(args);
		
	}

	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		
		create.setText("创建主席");
		create.setLayoutX(120);
		create.setLayoutY(150);
		create.setOnAction(e -> event_cm());
		
		name.setLayoutX(120);
		name.setLayoutY(200);
	
		p.setPrefSize(600, 500);
		p.getChildren().addAll(create, name);
		
		Scene scene = new Scene(p,300,300);
		primaryStage.setScene(scene);
		primaryStage.show();
	}
	
	private void event_cm() {
		if(cm == null) {
			cm = cm.getInstance();
			name.setText("创建主席：毛泽东");
		}else {
			name.setText("已有主席毛泽东");
		}
		
	}
	
}